# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-whitenoise
pkgver=6.6.0
pkgrel=1
pkgdesc='Radically simplified static file serving for WSGI applications'
arch=('any')
license=('MIT')
url='https://github.com/evansd/whitenoise'
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-brotli' 'python-django' 'python-pytest' 'python-requests')
source=("https://github.com/evansd/whitenoise/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('523070b760d17ff3b1ae263ea36d6b875acb2d9d05d562b1e24a24be84ebb026b7ebf558c6b6322a028a321c75dc3dfe7b3d84e8b3710754f05553820bc12f51')

build() {
  cd whitenoise-$pkgver
  python -m build -nw
}

check() {
  cd whitenoise-$pkgver
  DJANGO_SETTINGS_MODULE=tests.django_settings PYTHONPATH="$PWD"/src pytest
}

package() {
  cd whitenoise-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
